package cn.iocoder.an.module.mold.dal.mysql.upkeeptask;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.repairjob.RepairJobDO;
import cn.iocoder.an.module.mold.dal.dataobject.upkeeptask.UpkeepTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.upkeeptask.vo.*;

/**
 * 模具保养任务 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface UpkeepTaskMapper extends BaseMapperX<UpkeepTaskDO> {
    default PageResult<UpkeepTaskDO> selectPage(UpkeepTaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UpkeepTaskDO>()
                .eqIfPresent(UpkeepTaskDO::getAssigneerId, reqVO.getAssigneerId())
                .likeIfPresent(UpkeepTaskDO::getCode, reqVO.getCode())
                .eqIfPresent(UpkeepTaskDO::getDrawingNoId, reqVO.getDrawingNoId())
                .eqIfPresent(UpkeepTaskDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(UpkeepTaskDO::getAssigneerId, reqVO.getAssigneerId())
                .eqIfPresent(UpkeepTaskDO::getAssigneerIds, reqVO.getAssigneerIds())
                .eqIfPresent(UpkeepTaskDO::getUpkeepId, reqVO.getUpkeepId())
                .eqIfPresent(UpkeepTaskDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(UpkeepTaskDO::getNextUpkeepTime, reqVO.getNextUpkeepTime())
                .betweenIfPresent(UpkeepTaskDO::getRealUpkeepTime, reqVO.getRealUpkeepTime())
                .betweenIfPresent(UpkeepTaskDO::getTaskCreateTime, reqVO.getTaskCreateTime())
                .betweenIfPresent(UpkeepTaskDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UpkeepTaskDO::getId));
    }

}